/* 
 * File:   MixEditor.h
 * Author: ivosh-l
 *
 * Created on 9. leden 2012, 23:08
 */

#ifndef MIXEDITOR_H
#define	MIXEDITOR_H

#include "mix_file.h"

class MixEditor : public MixFile {
public:

    MixEditor(const char * pDir, const char * gmd = "global mix database.dat") : MixFile(pDir, gmd) {
        modifyFile = "modified.mix";
    }
    char addFile(std::string file);
    bool removeFile(std::string fileName);
    bool removeID(int fileID);
    //write(buff, len, filename);
    void setGame(t_game gameSet){ game = gameSet; }
    void setOutFile(std::string fname){ modifyFile = fname; }
protected:
    
    bool saveFile(std::string outFile, t_mix_header header, std::vector< t_mix_index_entry > mix_index, char * body);
    bool saveEncryptedFile(std::string outFile, t_mix_header header, std::vector< t_mix_index_entry > mix_index, char * body, char * keySource);
    t_game getGame(){ return game; }
    char * generateLocalMixDatabase(const std::vector< std::string > fnames);
private:

    t_game game;
    std::string modifyFile; //output file when editing content
    //bool saveBody(std::ofstream ofh);
};

#endif	/* MIXEDITOR_H */

